import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}

export function getCacheInfo(){
  const value = Cookies.get('currUser')
  if (value) {
    return JSON.parse(value)
  }
}

export function cacheInfo(user){
  return Cookies.set('currUser',JSON.stringify(user))
}

export function removeCacheInfo(){
  return Cookies.remove('currUser')
}
